﻿<Application x:Class="Quiz.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml">
    <!-- props - Namespace einbinden um auf die Appsettings zuzugreifen {Binding Source={x:Static props:Settings.Default}, Path=SchriftgroesseFrageText} -->
    
    <!-- Hinzufügen von Applikationsweiten Resourcen für das Layout -->
    <Application.Resources>
           <ResourceDictionary>
               <!-- Das ResourceDictionary einbinden in dem ich alle Bilder "verlinkt" habe -->
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="BilderResources.xaml"></ResourceDictionary>    
            </ResourceDictionary.MergedDictionaries>


            <Style x:Key="GridStyle" TargetType="Grid">
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF0061FF" Offset="0" />
                            <GradientStop Color="#990061FF" Offset="0.487" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="StackPanelStyle" TargetType="StackPanel">
                <Setter Property="Margin" Value="10,10,10,10"></Setter>
            </Style>

            <Style x:Key="BezeichnerLabel" TargetType="Label">
                <Setter Property="FontSize" Value="12"></Setter>
                <Setter Property="FontWeight" Value="Bold"></Setter>
                <Setter Property="Margin" Value="0,0,10,0"></Setter>
                <Setter Property="Width" Value="90"></Setter>
            </Style>

            <Style x:Key="TransparentButton" TargetType="Button">
                <Setter Property="Background" Value="Transparent"></Setter>
                <Setter Property="BorderBrush" Value="Transparent"></Setter>
            </Style>
            
             <!-- Definieren eines Schatteneffects für Label -->
            <Style x:Key="LabelShaddow" TargetType="Label">
                <Setter Property="FontSize" Value="30"></Setter>
                <!-- Schatteneffent einbinden -->
                <Setter Property="BitmapEffect">
                    <Setter.Value>
                        <DropShadowBitmapEffect Color="Black" Direction="330" Opacity="0.75" Softness="0.5" ShadowDepth="3" />
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="CloseButton" TargetType="Button" BasedOn="{StaticResource TransparentButton}">
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=WindowStyle, RelativeSource={RelativeSource AncestorType=Window}}" Value="None"></Condition>
                            <Condition Binding="{Binding Path=WindowState, RelativeSource={RelativeSource AncestorType=Window}}" Value="Maximized"></Condition>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Visibility" Value="Collapsed"></Setter>
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
               
            <Style x:Key="FrageTextBlock" TargetType="TextBlock">
                <Setter Property="Foreground" Value="Black"></Setter>
                <Setter Property="TextWrapping" Value="Wrap"></Setter>
                <Setter Property="FontSize" Value="{Binding Path=OptionAuswahl.SchriftgroesseFrage}"></Setter>
                <Setter Property="FontWeight" Value="Bold"></Setter>
                <Setter Property="VerticalAlignment" Value="Center"></Setter>
                <Setter Property="TextAlignment" Value="Center"></Setter>
                <Setter Property="BitmapEffect">
                    <Setter.Value>
                        <DropShadowBitmapEffect Color="Black" Direction="330" Opacity="0.75" Softness="0.5" ShadowDepth="3" />
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger  Binding="{Binding Path=DataContext.Status, RelativeSource={RelativeSource AncestorType=Window}}" Value="Beendet">
                        <Setter Property="Visibility" Value="Collapsed"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="AntwortListe" TargetType="ItemsControl">
                <Setter Property="BorderBrush" Value="Transparent"></Setter>
                <Setter Property="Background" Value="Transparent"></Setter>
            </Style>

            <Style x:Key="AntwortText" TargetType="Label" BasedOn="{StaticResource LabelShaddow}">
                <Setter Property="FontWeight" Value="Bold"></Setter>
                <Setter Property="Foreground" Value="Black"></Setter>
                <Setter Property="Margin" Value="0,20,0,0"></Setter>
                <Setter Property="FontSize" Value="{Binding Path=DataContext.OptionAuswahl.SchriftgroesseAntwort, RelativeSource={RelativeSource AncestorType=Window}}"></Setter>
                <Style.Triggers>
                    <MultiDataTrigger>
                        <!-- Die Richtige Antwort soll Größer und Grün dargestellt werden -->
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=DataContext.Status, RelativeSource={RelativeSource AncestorType=Window}}" Value="Auswertung"></Condition>
                            <Condition Binding="{Binding Path=Richtig}" Value="True"></Condition>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetProperty="FontSize" To="65" Duration="0:0:0.5"></DoubleAnimation>
                                    <ColorAnimation Storyboard.TargetProperty="Foreground.Color" To="#22E600" Duration="0:0:0.5"></ColorAnimation>
                                </Storyboard>
                            </BeginStoryboard>
                        </MultiDataTrigger.EnterActions>
                        <MultiDataTrigger.ExitActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetProperty="FontSize"  Duration="0:0:0.5"></DoubleAnimation>
                                    <ColorAnimation Storyboard.TargetProperty="Foreground.Color" Duration="0:0:0.5"></ColorAnimation>
                                </Storyboard>
                            </BeginStoryboard>
                        </MultiDataTrigger.ExitActions>     
                    </MultiDataTrigger>
                    <MultiDataTrigger>
                      <!-- Alle falschen Antworten sollen nur leicht ausgeblendet werden -->
                        <MultiDataTrigger.Conditions>
                            <!-- Es muss auf den DataContext den Hauptfensters zugegriffen werden, denn der Aktuelle DataContext im Template steht auf "Antwort" -->
                            <Condition Binding="{Binding Path=DataContext.Status, RelativeSource={RelativeSource AncestorType=Window}}" Value="Auswertung"></Condition>
                            <Condition Binding="{Binding Path=Richtig}" Value="False"></Condition>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetProperty="FontSize" To="40" Duration="0:0:0.5"></DoubleAnimation>
                                    <ColorAnimation Storyboard.TargetProperty="Foreground.Color" To="#F200FF" Duration="0:0:0.5"></ColorAnimation>
                                </Storyboard>
                            </BeginStoryboard>
                        </MultiDataTrigger.EnterActions>
                        <MultiDataTrigger.ExitActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetProperty="FontSize"  Duration="0:0:0.5"></DoubleAnimation>
                                    <ColorAnimation Storyboard.TargetProperty="Foreground.Color" Duration="0:0:0.5"></ColorAnimation>
                                </Storyboard>
                            </BeginStoryboard>
                        </MultiDataTrigger.ExitActions>
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="StatusAnzeige" TargetType="Label" BasedOn="{StaticResource LabelShaddow}">
                <Setter Property="Foreground" Value="Black"></Setter>
                <Setter Property="FontSize" Value="40"></Setter>
                <Setter Property="FontWeight" Value="Bold"></Setter>
                <Setter Property="Margin" Value="20,0,0,0"></Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=Status}" Value="Nichtgestartet">
                        <Setter Property="Visibility" Value="Hidden"></Setter>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=Status}" Value="Beendet">
                        <Setter Property="FontSize" Value="60"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="StatusAnzeigeStackPanel" TargetType="StackPanel">
                <Setter Property="Orientation" Value="Horizontal"></Setter>
                <Setter Property="HorizontalAlignment" Value="Center"></Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=Status}" Value="Beendet">
                        <Setter Property="Orientation" Value="Vertical"></Setter>
                        <Setter Property="Margin" Value="0,0,0,40"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>


            <Style x:Key="StatusAnzeigeRichtig" TargetType="Label" BasedOn="{StaticResource StatusAnzeige}">
                <Setter Property="Foreground" Value="#22E600"></Setter>
            </Style>
               
            <Style x:Key="StatusAnzeigeFalsch" TargetType="Label" BasedOn="{StaticResource StatusAnzeige}">
                <Setter Property="Foreground" Value="#F200FF"></Setter>
            </Style>

            <!-- Wenn die Fragen abgeschlossen sind, die Ergebnisse Untereinander auflisten. -->
            <Style x:Key="WeiterStackPanel" TargetType="StackPanel">
                <Setter Property="Visibility" Value="Collapsed"></Setter>
                <Setter Property="Margin" Value="0,100,0,0"></Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=Status}" Value="Beendet">
                        <Setter Property="Visibility" Value="Visible"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>


                <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->   
            <!-- Resourcen für die FRAGELISTE -->
            <Style x:Key="bearbeitenSP" TargetType="StackPanel" BasedOn="{StaticResource StackPanelStyle}">
                <Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding}" Value="{x:Null}">
                        <Setter Property="Visibility" Value="Hidden"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="ButtonBefehle" TargetType="Button">
                <Setter Property="Margin" Value="10,0,10,0"></Setter>
                <Setter Property="Padding" Value="10"></Setter>
                <Setter Property="Height" Value="45"></Setter>
                <Setter Property="FontWeight" Value="Bold"></Setter>
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="White" Offset="0" />
                            <GradientStop Color="#FFB80082" Offset="0.778" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ButtonStackPanel" TargetType="StackPanel">
                <Setter Property="Margin" Value="0,30,0,0"></Setter>
                <Setter Property="Orientation" Value="Horizontal"></Setter>
                <Setter Property="HorizontalAlignment" Value="Center"></Setter>
            </Style>


            <!-- Geht nicht, da ich nicht weiss was ich bei DataType angeben muss damit Antworten angezeigt werden. -->
            <!--<DataTemplate x:Key="DataTemplateListViewAntworten" DataType="{x:Type local:Antwort}">
                <ListView>
                    <ListView.ItemTemplate>
                        <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Style="{StaticResource AntwortText}" Content="{Binding Path=AntwortPos}"></Label>
                        <Label Style="{StaticResource AntwortText}" Content=". "></Label>
                        <Label Style="{StaticResource AntwortText}" Content="{Binding Path=Antworttext}"></Label>
                    </StackPanel>
                    <DataTemplate.Triggers>
                        <DataTrigger  Binding="{Binding Path=DataContext.Status, RelativeSource={RelativeSource AncestorType=Window}}" Value="Beendet">
                            <Setter  Property="Visibility" Value="Hidden"></Setter>
                        </DataTrigger>
                    </DataTemplate.Triggers>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </DataTemplate>-->


        </ResourceDictionary>

    </Application.Resources>
</Application>
  
